package com.gz.furnitures.entity;

import java.math.BigDecimal;

/**
 * create table furn (id int UNSIGNED PRIMARY key auto_increment, #id
 * 									`name` varchar(64) not null, #家具名
 * 									marker VARCHAR(64) not null, #制造商
 * 									price DECIMAL(11,2) not null,#价格 定点数(宽度11，精度两位小数)
 * 									sales int UNSIGNED not null, #销量
 * 									stock int UNSIGNED not null, #库存
 * 									img_path VARCHAR(256) not NULL #存放图片路径
 * 									)CHARSET=utf8;
 */
public class Furn {
    //注意这里用Integer而不用int是因为Integer可以为null而int不可以
    //Integer为null，可以让id自增
    private Integer id;
    private String name;
    private String maker;
    private BigDecimal price;
    private Integer sales;
    private Integer stock;
    //这里后面会做一个entity字段和mysql字段不一致如何解决
    //mysql:img_path  this:imgPath
    private String imgPath="assets/images/product-image/default.jpg";

    //无参构造器
    public Furn() {}

    @Override
    public String toString() {
        return "Furn{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", maker='" + maker + '\'' +
                ", price=" + price +
                ", sales=" + sales +
                ", stock='" + stock + '\'' +
                ", imgPath='" + imgPath + '\'' +
                '}';
    }

    public Integer getStock() {
        return stock;
    }

    public void setStock(Integer stock) {
        this.stock = stock;
    }

    public Furn(Integer id, String name, String maker, BigDecimal price, Integer sales, Integer stock, String imgPath) {
        this.id = id;
        this.name = name;
        this.maker = maker;
        this.price = price;
        this.sales = sales;
        this.stock = stock;
        if(!(null==imgPath||"".equals(imgPath))){
            this.imgPath = imgPath;
        }
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMaker() {
        return maker;
    }

    public void setMaker(String maker) {
        this.maker = maker;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getSales() {
        return sales;
    }

    public void setSales(Integer sales) {
        this.sales = sales;
    }

    public String getImgPath() {
        return imgPath;
    }

    public void setImgPath(String imgPath) {
        this.imgPath = imgPath;
    }
}
